package com.beta.springmvc.integrate;

import org.hibernate.validator.constraints.NotEmpty;
import org.springframework.format.annotation.DateTimeFormat;

import javax.validation.constraints.Past;
import java.util.Date;

/**
 * Created by yaoyt on 16/12/1.
 *
 * @author yaoyt
 */
public class User {
    private int id;

    @NotEmpty
    private String name;

    @Past     // past  表示是一个过去的时间
    @DateTimeFormat(pattern="yyyy-MM-dd")
    private Date birth;

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Date getBirth() {
        return birth;
    }

    public void setBirth(Date birth) {
        this.birth = birth;
    }

    @Override public String toString() { return "User [id=" + id + ", name=" + name + ", birth=" + birth + "]"; }

}
